package com.micro.ai.models.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 模型评估实体类
 * 
 * @author micro-ai
 * @since 0.0.1
 */
@Data
@TableName("model_evaluations")
@Schema(description = "模型评估信息")
public class ModelEvaluation implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(description = "评估ID", example = "eval_123456789")
    private String id;

    /**
     * 租户ID
     */
    @Schema(description = "租户ID", example = "tenant_001", required = true)
    private String tenantId;

    /**
     * 被评估的模型ID
     */
    @Schema(description = "被评估的模型ID", example = "model_123", required = true)
    private String modelId;

    /**
     * 评估数据集ID
     */
    @Schema(description = "评估数据集ID", example = "ds_123", required = true)
    private String evalDatasetId;

    /**
     * 评估名称
     */
    @Schema(description = "评估名称", example = "中文对话评估", required = true)
    private String evaluationName;

    /**
     * 总体评分
     */
    @Schema(description = "总体评分（0-1）", example = "0.95")
    private double overallScore;

    /**
     * 评估指标（JSON）
     */
    @Schema(description = "评估指标（JSON格式）", example = "{\"accuracy\":0.95,\"f1\":0.93}", required = true)
    private String metrics;

    /**
     * 详细结果（JSON）
     */
    @Schema(description = "详细结果（JSON格式）", example = "{\"perClass\":{\"class1\":0.95}}")
    private String detailedResults;

    /**
     * 混淆矩阵（JSON）
     */
    @Schema(description = "混淆矩阵（JSON格式）", example = "[[100,5],[3,92]]")
    private String confusionMatrix;

    /**
     * 评估耗时(秒)
     */
    @Schema(description = "评估耗时（秒）", example = "300")
    private Integer evalDuration;

    /**
     * 评估样本数
     */
    @Schema(description = "评估样本数", example = "1000")
    private Integer evaluatedSamples;

    /**
     * 状态
     */
    @Schema(description = "状态", example = "completed", allowableValues = {"running", "completed", "failed"})
    private String status;

    /**
     * 错误信息
     */
    @Schema(description = "错误信息", example = "评估超时")
    private String errorMessage;

    /**
     * 创建人ID
     */
    @Schema(description = "创建人ID", example = "1001", required = true)
    private String createdBy;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建时间", example = "2025-01-01 00:00:00")
    private LocalDateTime createdAt;

    /**
     * 完成时间
     */
    @Schema(description = "完成时间", example = "2025-01-01 00:05:00")
    private LocalDateTime completedAt;
}
